package fdoj.eventInvitations.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 *Klasa koja predstavlja model komentara iz naseg sistema;
 *
 */
@Entity
@Table(name="comments")
public class Comment implements Serializable{
	/**
	 *
	 */
	private static final long serialVersionUID = 6969228928628650141L;

	/**
	 * @param id je identifikator
	 */
	@Id
	@GeneratedValue(strategy=IDENTITY)
	@Column(name="comment_id", unique=true, nullable=false)
	private Integer id;
	/**
	 *  @param text predstavlja sam sadrzaj komentara
	 */
	@Column(name="text", unique=false, nullable=true)
	private String text;
	/**
	 * @param date je datum nastanaka komentara
	 */
	@Column(name="date", unique=false, nullable=false)
	private Date date;
	/**
	 * @param poster je osoba koja je postavila komentar
	 */
	@ManyToOne
	@JoinColumn(name="poster_id", referencedColumnName="person_id", nullable=false)
	private Person poster;
	/**
	 * @param comment je event na koji je zakacen ovaj komentra
	 */
	@ManyToOne
	@JoinColumn(name="eventComment_id", referencedColumnName="event_id", nullable=false)
	private Event comment;

	public Comment(){

	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Person getPoster() {
		return poster;
	}

	public void setPoster(Person poster) {
		this.poster = poster;
	}

	public Event getComment() {
		return comment;
	}

	public void setComment(Event comment) {
		this.comment = comment;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

}
